package com.hubstc.book_borrow.service.impl;


import com.hubstc.book_borrow.mapper.BorrowMapper;
import com.hubstc.book_borrow.service.BorrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;


@Service
public class BorrowServiceImpl implements BorrowService {

    @Autowired
    private BorrowMapper borrowMapper;

    @Override
    public void addBorrow(String readerId,String bookId) {
        LocalDate borrowDate=LocalDate.now();
        borrowMapper.addBorrow(readerId,bookId,borrowDate);
    }

    @Override
    public void returnBorrow(Integer borrowId) {
        LocalDate borrowDate=LocalDate.now();
        borrowMapper.returnBook(borrowId,borrowDate);
    }

    @Override
    public Map<String,Object> selectBorrow(String readerId) {
        return borrowMapper.selectBorrow(readerId);
    }
}
